n = 5000

p = [1 for i in xrange(n)]

p[0] = p[1] = 0

for i in xrange(2, n):
    if p[i]:
        for j in xrange(i + i, n, i):
            p[j] = 0

p = [i for i in xrange(n) if p[i]]

print len(p), sum(p)

